﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace unittextDemo
{
    public class Program
    {
        static void Main(string[] args)
        {
        }
        public int xuanzhuan(int[] num, int k)
        {
            int a = 0;
            int Num = num.Length;
            if (Num == 0)
                return -1;
            k %= Num;
            if(k ==0 )
            {
                return num[0];
            }
            if (k < 0)
            {
                k = Num + k;
            }
            fanzhuan(num, 0, Num - 1);
            fanzhuan(num, 0, k - 1);
            fanzhuan(num, k, Num - 1);
            a = num[0];
            return a;
        }
       static void fanzhuan(int []a,int begin,int end)
        {
            int temp;
            while (begin < end)
            {
                temp = a[begin];
                a[begin] = a[end];
                a[end] = temp;
            }
        }
    }
    
}
